package com.mlethe.android.demo.dialog;

import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;

import com.mlethe.android.demo.R;
import com.mlethe.library.dialog.DialogFragment;

/**
 * @author Mlethe
 * @date 2020/8/5
 */
public class TestOneDialog extends DialogFragment {
    @Override
    protected int getLayoutId() {
        return R.layout.layout_dialog;
    }

    @Override
    protected void onBindViewHolder(Bundle savedInstanceState, ViewHolder holder) {
        setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialogInterface) {
            }
        });
        holder.setOnClickListener(R.id.dialog_cancel_btn, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
            }
        })
                .setOnClickListener(R.id.dialog_confirm_btn, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        dismiss();
                    }
                });
    }

    @Override
    protected boolean getNoTitle() {
        return true;
    }

    @Override
    protected boolean getCancelableOnTouchOutside() {
        return true;
    }

    @Override
    protected float getDimAmount() {
        return 0.3f;
    }
}
